package com.kika.obwiki.rep;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Pattern;

@Data
@Schema(name = "测试sayhello参数类")  // OpenAPI 3.0 注解
public class DemoReq {
    @NotBlank
    // @Pattern(regexp = "^[\\u4e00-\\u9fa5]{2,15}$", message = "姓名应为2-15中文")
    @Schema(description = "姓名：2-15中文", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
    private String name;

    @NotBlank(message = "手机号不能为空！")
    @Pattern(regexp = "^1[3|4|5|6|7|8|9][0-9]{9}$", message = "手机号格式不正确！")
    @Schema(description = "手机号", requiredMode = Schema.RequiredMode.REQUIRED, example = "13800138000")
    private String phone;

    @NotEmpty(message = "密码必须填写")
    @Length(min = 6, max = 20, message = "密码必须是6-20位字符")
    @Schema(description = "密码", requiredMode = Schema.RequiredMode.REQUIRED, minLength = 6, maxLength = 20)
    private String password;

    public String getName() {
        return name;
    }

    public String getPhone() {
        return phone;
    }

    public String getPassword() {
        return password;
    }
}
